﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewsDetails_Admin.aspx.cs"
    Inherits="Admin_NewsDetails_Admin" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>News Details</title>

    <script type="text/javascript">
        function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)				
            return oWindow;
        }

        function CloseWnd()
        {
            GetRadWindow().close();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server" />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EatDrinkConnectionString %>"
        SelectCommand="SELECT * FROM [News] WHERE ([NewsID] = @NewsID)">
        <SelectParameters>
            <asp:QueryStringParameter Name="NewsID" QueryStringField="NewsID" Type="Int64" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:EatDrinkConnectionString %>"
        SelectCommand="SELECT * FROM [NewsStyle]"></asp:SqlDataSource>
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        Width="100%" Height="100%" DataSourceID="SqlDataSource1">
        <Fields>
            <asp:TemplateField HeaderText="NewsStyleID" SortExpression="NewsStyleID">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlNewsStyleID" runat="server" DataSourceID="SqlDataSource2"
                        DataTextField="NewsStyleName" DataValueField="NewsStyleID" Height="22px" SelectedValue='<%# Bind("NewsStyleID") %>'
                        Width="231px">
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="ddlNewsStyleID" runat="server" DataSourceID="SqlDataSource2"
                        DataTextField="NewsStyleName" DataValueField="NewsStyleID" Height="22px" SelectedValue='<%# Bind("NewsStyleID") %>'
                        Width="231px">
                    </asp:DropDownList>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="NewsTitle" SortExpression="NewsTitle">
                <EditItemTemplate>
                    <asp:TextBox ID="txtTitle" runat="server" Height="22px" Text='<%# Bind("NewsTitle") %>'
                        Width="231px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Nhập Tên News Title !!"
                        ControlToValidate="txtTitle"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtTitle" runat="server" Height="22px" Text='<%# Bind("NewsTitle") %>'
                        Width="231px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Font-Size="Medium"
                        ControlToValidate="txtTitle" ErrorMessage="Nhập Tên News Title !!"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="News Short" SortExpression="News Short">
                <EditItemTemplate>
                    <telerik:RadEditor Style="height: 300px; overflow: auto" EnableResize="false" Height="350px"
                        ID="RadEditorShort" runat="server" Width="500px" Content='<%#Bind("NewsShort") %>' Skin="Web20">
                        <Tools>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="Bold" />
                                <telerik:EditorTool Name="Italic" />
                                <telerik:EditorTool Name="Underline" />
                            </telerik:EditorToolGroup>
                        </Tools>
                        <Modules>
                            <telerik:EditorModule Name="RadEditorStatistics" />
                        </Modules>
                        <Content>
                        </Content>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Bạn Chưa Nhập News Short !!!"
                        Font-Size="Medium" ControlToValidate="RadEditorShort"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadEditor Style="height: 300px; overflow: auto" EnableResize="false" Height="350px"
                        ID="RadEditorShort" runat="server" Width="500px" Skin="Web20">
                        <Tools>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="Bold" />
                                <telerik:EditorTool Name="Italic" />
                                <telerik:EditorTool Name="Underline" />
                            </telerik:EditorToolGroup>
                        </Tools>
                        <Modules>
                            <telerik:EditorModule Name="RadEditorStatistics" />
                        </Modules>
                        <Content>
                        </Content>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="RadEditorShort"
                        Font-Size="Medium" ErrorMessage="Bạn Chưa Nhập News Short !!!"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="News Long" SortExpression="News Long">
                <EditItemTemplate>
                    <telerik:RadEditor ID="RadEditorLong" Style="height: 300px; overflow: auto" EnableResize="false"
                        Height="350px" runat="server" Width="500px" Content='<%#Bind("NewsLong") %>' Skin="Web20">
                        <Tools>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="Bold" />
                                <telerik:EditorTool Name="Italic" />
                                <telerik:EditorTool Name="Underline" />
                            </telerik:EditorToolGroup>
                        </Tools>
                        <Modules>
                            <telerik:EditorModule Name="RadEditorStatistics" />
                        </Modules>
                        <Content>
                        </Content>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="RadEditorLong"
                        Font-Size="Medium" ErrorMessage="Bạn Chưa Nhập News Long !!!"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadEditor ID="RadEditorLong" Style="height: 300px; overflow: auto" EnableResize="false"
                        Height="350px" runat="server" Width="500px" Skin="Web20">
                        <Tools>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="Bold" />
                                <telerik:EditorTool Name="Italic" />
                                <telerik:EditorTool Name="Underline" />
                            </telerik:EditorToolGroup>
                        </Tools>
                        <Modules>
                            <telerik:EditorModule Name="RadEditorStatistics" />
                        </Modules>
                        <Content>
                        </Content>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="RadEditorLong"
                        Font-Size="Medium" ErrorMessage="Bạn Chưa Nhập News Long !!!"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Image" SortExpression="Image">
                <EditItemTemplate>
                    <asp:FileUpload ID="FileUpload1" runat="server" Height="26px" Width="245px" 
                        Font-Size="Medium" />
                    <br />
                    <asp:Image ID="Image1" runat="server" Height="100px" Width="100px" ImageUrl='<%# Eval("NewsImageName", "~/Images/News/{0}") %>' />
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:FileUpload ID="FileUpload1" runat="server" Height="26px" Width="265px" 
                        Font-Size="Medium" />
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Path" SortExpression="Path">
                <EditItemTemplate>
                    <asp:TextBox ID="txtPath" runat="server" Height="22px" Text='<%# Bind("NewsPath") %>'
                        Width="231px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtPath" runat="server" Height="22px" Text='<%# Bind("NewsPath") %>'
                        Width="231px"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="IsShowHomePage" SortExpression="IsShowHomePage">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlIsActivated" runat="server" AppendDataBoundItems="True"
                        DataSource='<%# (new string[] {"True", "False"}) %>' Enabled="true" Height="22px"
                        SelectedValue='<%# Eval("IsShowHomePage") %>' Width="231px">
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="ddlIsActivated" runat="server" AppendDataBoundItems="True"
                        DataSource='<%# (new string[] {"True", "False"}) %>' Enabled="true" Height="22px"
                        Width="231px">
                    </asp:DropDownList>
                </InsertItemTemplate>
            </asp:TemplateField>
        </Fields>
    </asp:DetailsView>
    <div style="text-align: left;">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;
        <asp:Button ID="Button3" runat="server" Text="Button" OnClick="Button3_Click" BackColor="#D4E7FA"
            Font-Bold="True" ForeColor="#FF6600" Font-Size="Medium" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button4" runat="server" Text="Cancel" OnClientClick="CloseWnd();return false;"
            BackColor="#D4E7FA" Font-Bold="True" ForeColor="#FF6600" 
            Font-Size="Medium" />
    </div>
    </form>
</body>
</html>
